import Mock, { Random } from 'mockjs'

const list = () => {
  Random.dataImage('116x116')
  Random.dataImage('750x342')
  Random.dataImage('150x150')
  Random.cword(1,10);
  Random.cword(30,40);
  const data = Mock.mock({
    'data|4': [{
      "id|+1": 1000,
      "storeImg|+1":"@dataImage('116x116')",
      "name|+1":["adidas旗舰店","优选下午茶","每日推荐","爆款零食"],
      "info|+1":["官方旗舰店","休闲下午茶店9：00至24：00","每日首选推荐店铺","热卖爆款零食店铺"],
      "dis|+1":["1810.2","1818.5","1811.4","1813.6"],
      "bg|+1":"@dataImage('750x342')",
      "banner|+1":"@cword(1,10)",
      "list|20-30":[{
        "id|+1":10000,
        "img|+1":"@dataImage('150x150')",
        "title|+1":"@cword(30,40)",
        "score|60-100":100,
        "buy|0-20":20,
        "price|20-500":500,
        "oldPrice|500-700":700,
        "save|100-1000":1000,
        "type|1-2":2
      }]
    }]
  });
  return {
    code: 0,
    msg: '成功',
    data
  }
}
Mock.mock('/api/list', 'get', list)


const hydrosList = () => {
  Random.cword(1,10);
  Random.cword(5,20);
  Random.cword(1,5);
  Random.cword();
  Random.dataImage('58x58')
  Random.dataImage('218x218')
  Random.dataImage('18x18')
  Random.date('yy-MM-dd')
  const data = Mock.mock({
    'data|50': [{
      "id|+1": 0,
      "perImg|+1":'@dataImage(58x58)',
      "name|+1":'@cword(1,5)',
      "time|+1":"@date('yyyy-MM-dd')",
      "title|+1":"@cword(1,10)",
      "text|+1":"@cword(5,20)",
      "imgSrc|+1":"@dataImage(218x218)",
      "goodNum|0-100":100,
      "list|5-10":[{
        "id|+1":100,
        "perImg|+1":"@dataImage('18x18')",
        "name|+1":'@cword(1,10)',
        "time|+1":"@date('yyyy-MM-dd')",
        "text|+1":"@cword()",
      }]
      
    }]
  });
  return {
    code: 0,
    msg: '成功',
    data
  }
}

Mock.mock('/api/hydrosList', 'get',hydrosList)

//const list = () => {
  //   Random.csentence();
  //   Random.dataImage('200x100')
  //   const data = Mock.mock({
  //     'data|6': [{
  //       "id|+1": 0,
  //       "title|+1": ["女鞋", "男鞋", "运动", "户外", "儿童", "箱包"],
  //       "list|3-5": [{
  //         "titleId|+1": 100,
  //         "title|1": ["品牌", "热销推荐", "靴子", "单鞋", "凉鞋", "精选分类"],
  //         "list|4-12": [{
  //           "id|+1": 1000,
  //           "title|+1": ['百丽', '森达', '暇步士', '拔佳', '天美意', '他她', '百思图', '伐拓', '圣伽步'],
  //           "imgSrc|+1": '@dataImage',
  //           "goodsList|10-30": [{
  //             "goodsId|+1": 10000,
  //             "name|+1": '@csentence',
  //             "oldPrice|1500-2000": 500,
  //             "price|51-1500": 300,
  //             "imgSrc|+1": Random.dataImage('200x100'),
  //             "discounts|1": ['两件8.0折', '两件9.0折'],
  //             "type|1": ["女鞋", "男鞋", "运动", "户外", "儿童", "箱包"],
  //             "category|1": ["品牌", "热销推荐", "靴子", "单鞋", "凉鞋", "精选分类"],
  //             "brand|1": ['百丽', '森达', '暇步士', '拔佳', '天美意', '他她', '百思图', '伐拓', '圣伽步'],
  //             "size|1": [36, 37, 38, 39, 40, 41, 42, 43]
  //           }]
  //         }]
  //       }]
  //     }]
  //   });
  //   return {
  //     code: 0,
  //     msg: '成功',
  //     data
  //   }
  // }
  
  // Mock.mock('/api/data', 'get', list)

